﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.views.components {
    import reprise.ui.*;
    import reprise.controls.*;
    import net.wooga.pets.views.components.computerdisplay.*;
    import net.wooga.pets.views.missions.*;
    import net.wooga.pets.views.windows.main.*;
    import net.wooga.pets.views.windows.sun.*;
    import net.wooga.pets.views.components.sunface.*;
    import net.wooga.pets.utils.*;
    import net.wooga.pets.views.tutorial.chapter.*;
    import net.wooga.pets.views.goods.*;

    public class MetaMenu extends UIComponent {

        private var _xpDisplay:UIComponent;
        private var _xpIcon:UIComponent;
        private var _xpIndicator:UIComponent;
        private var _xpLevelLabel:Label;
        private var _xpPoints:Label;
        private var _xpIndicatorBar:UIComponent;
        private var _xpIndicatorFrame:UIComponent;
        private var _xpTooltipLabel:String;
        private var _levelButtonsDisplay:UIComponent;
        private var _oldLevel:int;// = 0
        private var _energyDisplay:SimpleButton;
        private var _energyIndicator:UIComponent;
        private var _energyIcon:UIComponent;
        private var _energyIndicatorFrame:UIComponent;
        private var _energyIndicatorBar:UIComponent;
        private var _energyPoints:Label;
        private var _energyTooltipLabel:String;
        private var _energyAddButton:Label;
        private var _maxEnergyPoints:int;
        private var _goodsDisplay:SimpleButton;
        private var _goodsIndicator:UIComponent;
        private var _goodsIcon:UIComponent;
        private var _goodsIndicatorFrame:UIComponent;
        private var _goodsIndicatorBar:UIComponent;
        private var _goodsPoints:Label;
        private var _goodsTooltipLabel:String;
        private var _coins:PointsDisplay;

        public static var ENERGY_BAR_OFFSET:int = 125;
        public static var ENERGY_LIMIT_FOR_BUY_BOOSTS:int = 3;

        public function setXPTooltipLabel(_arg1:String):void{
            this._xpTooltipLabel = _arg1;
        }
        public function setEnergyTooltip(_arg1:String):void{
            this._energyTooltipLabel = _arg1;
        }
        public function setGoodsTooltip(_arg1:String):void{
            this._goodsTooltipLabel = _arg1;
        }
        public function setEnergyAddButtonLabel(_arg1:String):void{
            this._energyAddButton.setLabel(_arg1);
        }
        public function setMaxEnergyPoints(_arg1:int):void{
            this._maxEnergyPoints = _arg1;
        }
        public function updateEnergy(_arg1:int, _arg2:int, _arg3:int):void{
            var _local4:int = (_arg1 + _arg2);
            if (_local4 > _arg3){
                this._energyPoints.addCSSClass("highlight");
            } else {
                this._energyPoints.removeCSSClass("highlight");
            };
            this._energyPoints.setLabel(((_local4.toString() + "/") + _arg3.toString()));
            this._energyIndicator.setTooltipData(this._energyTooltipLabel);
            var _local5:Number = (_local4 / _arg3);
            _local5 = Math.min(_local5, 1);
            this._energyIndicatorBar.setStyle("left", String(((_local5 * 125) - 125)));
            var _local6 = (_local4 <= ENERGY_LIMIT_FOR_BUY_BOOSTS);
            this._energyDisplay.cssID = (_local6) ? "canBuy" : "";
        }
        public function updateGoods(_arg1:int, _arg2:int):void{
            if (_arg1 > _arg2){
                this._goodsPoints.addCSSClass("highlight");
            } else {
                this._goodsPoints.removeCSSClass("highlight");
            };
            this._goodsPoints.setLabel(((_arg1 + "/") + _arg2));
            this._goodsDisplay.setTooltipData(this._goodsTooltipLabel);
            var _local3:Number = (Math.min(_arg1, _arg2) / _arg2);
            this._goodsIndicatorBar.setStyle("left", String(((_local3 * 125) - 125)));
        }
        public function updateLevel(_arg1:int):void{
            if (this._oldLevel < _arg1){
                this._oldLevel = _arg1;
                this._xpLevelLabel.setLabel(_arg1.toString());
            };
        }
        public function updateXP(_arg1:String, _arg2:Number):void{
            this._xpPoints.setLabel(_arg1);
            this._xpDisplay.setTooltipData(((this._xpTooltipLabel + " ") + _arg2));
        }
        public function updateBar(_arg1:Number):void{
            this._xpIndicatorBar.setStyle("left", String(((_arg1 * 107) - 107)));
        }
        public function createCheatButton(_arg1:String):void{
            var _local2:LabelButton = LabelButton(this._levelButtonsDisplay.addComponent("button cheatButton", null, LabelButton));
            _local2.setLabel((("<span>" + _arg1) + "</span>"));
            _local2.setData(_arg1);
        }
        override protected function initialize():void{
            super.initialize();
            cssID = "metaMenu";
        }
        override protected function createChildren():void{
            this.createMissionBrowser();
            this.createGoodsButton();
            this._coins = PointsDisplay(addChild(new PointsDisplay("CoinsAnim")));
            this._coins.cssID = "coinsDisplay";
            this.createEnergyComponent();
            this.createLevelXPComponent();
            this.createGoodsComponent();
            addChild(new GameViewOptionsMenu());
            addChild(new ComputerDisplay());
            addChild(new TutorialOverlay());
            addChild(new TutorialLevel1View());
            addChild(new TutorialFirstRoomView());
            addChild(new TutorialFountainView());
            addChild(new TutorialKitchenView());
            addChild(new TutorialKindergartenView());
            addChild(new SunFaceView());
            addChild(new SunWindowsContainer());
            addChild(new MainWindowsContainer());
            this._levelButtonsDisplay = addComponent("cheatButtonsDisplay");
            this._levelButtonsDisplay.hide();
        }
        public function setMissionTooltip(_arg1:String):void{
        }
        public function get energyBar():UIComponent{
            return (this._energyDisplay);
        }
        private function createMissionBrowser():void{
            var _local1:MissionBrowserView = new MissionBrowserView();
            addChild(_local1);
        }
        private function createGoodsButton():void{
            var _local1:GoodsButton = new GoodsButton();
            _local1.x = 110;
            _local1.y = 80;
            addChildAt(_local1, 0);
        }
        private function createLevelXPComponent():void{
            this._xpDisplay = addComponent("showcardGothicFont xpDisplay");
            this._xpIcon = this._xpDisplay.addComponent("xpIconAnimation");
            this._xpIndicator = this._xpDisplay.addComponent("xpIndicator");
            this._xpIndicatorBar = this._xpIndicator.addComponent("xpIndicatorBar");
            this._xpIndicatorFrame = this._xpIndicator.addComponent("xpIndicatorFrame");
            this._xpLevelLabel = Label(this._xpDisplay.addComponent("showcardGothicFontOutline xpLevelLabel", null, Label));
            this._xpPoints = Label(this._xpIndicator.addComponent("showcardGothicFontOutline xpPoints", null, Label));
            var _local1:UIComponent = this._xpDisplay.addComponent("xpIndicator");
            _local1.hide();
            this._xpIndicatorBar.mask = _local1;
        }
        private function createEnergyComponent():void{
            this._energyDisplay = RepriseUtils.addSimpleButton(this, "energyDisplay");
            this._energyIndicator = this._energyDisplay.addComponent("energyIndicator");
            this._energyIndicatorBar = this._energyIndicator.addComponent("energyIndicatorBar");
            this._energyIndicatorFrame = this._energyIndicator.addComponent("energyIndicatorFrame");
            this._energyPoints = Label(this._energyIndicator.addComponent("showcardGothicFontOutline energyPoints", null, Label));
            var _local1:UIComponent = this._energyDisplay.addComponent("energyIndicator");
            _local1.hide();
            this._energyIndicatorBar.mask = _local1;
            this._energyIcon = this._energyDisplay.addComponent("energyIcon");
            this._energyAddButton = RepriseUtils.addLabel(this._energyDisplay, "myriadProFont addEnergyLabel");
        }
        private function createGoodsComponent():void{
            this._goodsDisplay = RepriseUtils.addSimpleButton(this, "goodsDisplay");
            this._goodsDisplay.hide();
            this._goodsIndicator = this._goodsDisplay.addComponent("goodsIndicator");
            this._goodsIndicatorBar = this._goodsIndicator.addComponent("goodsIndicatorBar");
            this._goodsIndicatorFrame = this._goodsIndicator.addComponent("goodsIndicatorFrame");
            this._goodsPoints = Label(this._goodsIndicator.addComponent("showcardGothicFontOutline goodsPoints", null, Label));
            var _local1:UIComponent = this._goodsDisplay.addComponent("goodsIndicator");
            _local1.hide();
            this._goodsIndicatorBar.mask = _local1;
            this._goodsIcon = this._goodsDisplay.addComponent("goodsIcon");
        }
        public function get goodsDisplay():SimpleButton{
            return (this._goodsDisplay);
        }
        public function enableGoodsDisplay(_arg1:Boolean):void{
            if (_arg1){
                this._goodsDisplay.removeCSSClass("inactive");
            } else {
                this._goodsDisplay.addCSSClass("inactive");
            };
        }

    }
}//package net.wooga.pets.views.components 
